#include "ot-main.h"
#include "ot-builtins.h"
#include "ostree.h"
+#include "ot-tool-util.h"
#include "otutil.h"
static void
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED, message);
}
-static gboolean
-parse_keyvalue (const char *keyvalue,
- char **out_key,
- char **out_value,
- GError **error)
-{
- const char *eq = strchr (keyvalue, '=');
- if (!eq)
- {
- g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
- "Missing '=' in KEY=VALUE for --set");
- return FALSE;
- }
- *out_key = g_strndup (keyvalue, eq - keyvalue);
- *out_value = g_strdup (eq + 1);
- return TRUE;
-}
-
static char **opt_set;
static gboolean opt_no_gpg_verify;
static gboolean opt_if_not_exists;
gs_free char *subkey = NULL;
gs_free char *subvalue = NULL;
- if (!parse_keyvalue (keyvalue, &subkey, &subvalue, error))
+ if (!ot_parse_keyvalue (keyvalue, &subkey, &subvalue, error))
goto out;
g_variant_builder_add (optbuilder, "{s@v}",
return TRUE;
}
+
+gboolean
+ot_parse_keyvalue (const char *keyvalue,
+ char **out_key,
+ char **out_value,
+ GError **error)
+{
+ const char *eq = strchr (keyvalue, '=');
+ if (!eq)
+ {
+ g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
+ "Missing '=' in KEY=VALUE for --set");
+ return FALSE;
+ }
+ *out_key = g_strndup (keyvalue, eq - keyvalue);
+ *out_value = g_strdup (eq + 1);
+ return TRUE;
+}